﻿# coding:utf-8
# 标签纸价格计算
# 输入标签纸规格,输出价格,每卷标签纸张数.

from PyQt4 import QtCore, QtGui
from label_ui import Ui_widget
copperplate_label = 6
thermal_label = 8

class label_count(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_widget()
        self.ui.setupUi(self)
        QtCore.QObject.connect(self.ui.input_line,QtCore.SIGNAL("valueChanged(int)"), self.count)
        QtCore.QObject.connect(self.ui.input_width,QtCore.SIGNAL("valueChanged(int)"), self.count)
        QtCore.QObject.connect(self.ui.input_long,QtCore.SIGNAL("valueChanged(int)"), self.count)
    def count(self):
        width = 102
        lab_width = self.ui.input_width.value()+2
        lab_long = self.ui.input_long.value()+2
        lab_line = self.ui.input_line.value()
        self.ui.input_long.setMinimum(1)
        self.ui.input_width.setMinimum(1)
        self.ui.input_line.setMinimum(1)
        self.ui.input_line.setMaximum(width/lab_width)
        self.ui.input_width.setMaximum(width)
        amount1=(500000 * lab_width) /(lab_long * lab_width) * lab_line
        self.ui.output_amount1.setText(QtCore.QString.number(amount1))
        self.ui.output_width1.setText(QtCore.QString.number(lab_width))
if __name__ == "__main__":
    import sys
    app = QtGui.QApplication(sys.argv)
    myapp = label_count()
    myapp.show()
    sys.exit(app.exec_())
